%{
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "y.tab.h"

int line_n=1;
%}

%%
if 			{ return IF; }
else 			{ return ELSE; }
fi	 		{ return FI; }
for	 		{ return FOR; }
rof	 		{ return ROF; }
do 			{ return DO; }
while 		{ return WHILE; }
loop 			{ return LOOP; }
var 			{ return VAR; }
endvar	 	{ return ENDVAR; }
[a-zA-Z_][a-zA-Z0-9_-]*	{ yylval.sval = yytext; return ID; }
[0-9]+			{ yylval.ival = atoi(yytext); return INT; }
[0-9]+.[0-9]*		{ yylval.fval = atof(yytext); return FLOAT; }
[0-9]*.[0-9]+		{ yylval.fval = atof(yytext); return FLOAT; }
\"			{ return QUOTE; }
\-			{ return MINUS; }
\+			{ return PLUS; }
\*			{ return MULTIPLY; }
\/			{ return DIVIDE; }
=			{ return ASSIGN; }
!			{ return NOT; }
\>			{ return GREATERTHAN; }
\<			{ return LESSTHAN; }
\(			{ return OBRACKET; }
\)			{ return EBRACKET; }
\[			{ return OSQBRACKET; }
\]			{ return ESQBRACKET; }
\n			{ ++line_n; return ENDL; };
[ \t]+		/* ignore whitespace */;
%%
